package com.hurt.competition.common.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.File;

@Component
public class CommonConfig implements InitializingBean {

    public static String TEMPDIR;

    @Value("${file.upload}")
    public void setTEMPDIR(String tempdir){
        CommonConfig.TEMPDIR = tempdir;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        File file = new File(TEMPDIR);
        if(!file.exists()){
            file.mkdirs();
        }
    }
}
